package cn.lzb.book.server.common.exception;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BookServerException extends RuntimeException implements BaseException {

    private int code;
    private String message;

    public BookServerException(String message) {
        super(message);
        this.code = 500;
        this.message = message;
    }

    public BookServerException(BaseException baseException) {
        super(baseException.getMessage());
        this.code = baseException.getCode();
        this.message = baseException.getMessage();
    }

    public BookServerException(BaseException baseException, String message) {
        super(baseException.getMessage());
        this.code = baseException.getCode();
        this.message = message;
    }


}
